<template>
<div></div>
</template>

<script>
import { Toast } from 'mand-mobile'
import p1 from '@/assets/pp1.jpg'
import p2 from '@/assets/pp2.jpg'
import p3 from '@/assets/pp3.jpg'
export default {
  name: 'entry',
  data () {
    return {}
  },
  created: async function () {
    if (!this.$store.state.wxuser.openid && this.$route.query.openid) {
      // 根据 openid来获取用户信息
      let _u = await this.$api.post('/getUser', this.$route.query)
      window.localStorage.setItem('wxopenid', this.$route.query.openid)
      if (_u.data.state) {
        // this.$store.commit('updateUser')
        this.$store.dispatch('getUser')
        this.$router.replace({ name: 'Home' })
      } else {
        Toast.failed('获取用户失败')
      }
    }
  },
  beforeMount: async function () {

  },
  mounted: async function () {
  }
}
</script>

<style scoped>

</style>
